<html>
<head><meta charset="utf-8"><title>benchmarking on a thermally-constrained laptop · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html">benchmarking on a thermally-constrained laptop</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="168798959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168798959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168798959">(Jun 23 2019 at 16:11)</a>:</h4>
<p>I’ve a MacBook with a 6-core i9 at 2.9 GHz. I’m trying to do some CPU-related benchmarking but I’m seeing some pretty big swings (e.g. ~14%) when I haven’t changed code. I’m guessing that things like Turboboost and thermal load are affecting me. </p>
<p>Does anyone know of a way I can construct a more stable benchmark on this machine?</p>



<a name="168802693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168802693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168802693">(Jun 23 2019 at 18:07)</a>:</h4>
<p>If it has anything resembling firmware configuration, you could go there an underclock your CPU, which by extension would disable boosting and any sort of frequency adjustment..</p>



<a name="168802802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168802802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168802802">(Jun 23 2019 at 18:10)</a>:</h4>
<p>your best bet is put your macbook into a freezer and load the null cpufreq kmod (don’t remember what it is called, sadly)</p>



<a name="168802972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168802972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168802972">(Jun 23 2019 at 18:15)</a>:</h4>
<p>there is a kext to disable turboboost too, so coupled with null cpufreq kext you should be in a pretty stable situation <a href="https://github.com/nanoant/DisableTurboBoost.kext" target="_blank" title="https://github.com/nanoant/DisableTurboBoost.kext">https://github.com/nanoant/DisableTurboBoost.kext</a></p>



<a name="168803021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168803021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168803021">(Jun 23 2019 at 18:16)</a>:</h4>
<p>There’s still thermal throttling, and you won’t be able to deal with it without a higher difference in temperature between your rads and air.</p>



<a name="168804889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168804889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168804889">(Jun 23 2019 at 19:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> have you tried other metrics, such as instruction count? it's usually much more stable.</p>



<a name="168804891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168804891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168804891">(Jun 23 2019 at 19:14)</a>:</h4>
<p>on Linux <code>perf</code> can measure that with very little overhead, no idea about macOS though.</p>



<a name="168805959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168805959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168805959">(Jun 23 2019 at 19:51)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> thats a good point. I could even run in a VM for that, since the actual wallclock wouldn’t matter as much</p>



<a name="168805962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168805962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168805962">(Jun 23 2019 at 19:51)</a>:</h4>
<p>I’m not <em>super</em> excited about putting my laptop in a freezer <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="168807249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168807249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168807249">(Jun 23 2019 at 20:34)</a>:</h4>
<p>Instruction count is only useful if you know that instructions have approximately the same throughput and latency, which they don’t.</p>



<a name="168807258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168807258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168807258">(Jun 23 2019 at 20:35)</a>:</h4>
<p>However if what <em>is</em> very useful is number of cycles <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="168807259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168807259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168807259">(Jun 23 2019 at 20:35)</a>:</h4>
<p>(also measured by perf)</p>



<a name="168808358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808358">(Jun 23 2019 at 21:11)</a>:</h4>
<p>however number of cycles has almost as much variance as time</p>



<a name="168808369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808369">(Jun 23 2019 at 21:11)</a>:</h4>
<p>so while instruction count is a worse proxy for performance than cycles, it can be measured much better, making it overall more useful</p>



<a name="168808375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808375">(Jun 23 2019 at 21:11)</a>:</h4>
<p>that's why instructions is also the default view for rust-perf</p>



<a name="168808416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808416">(Jun 23 2019 at 21:12)</a>:</h4>
<p>(there was a long post where someone from the team explained that all in more detail but I cannot find it now)</p>



<a name="168808473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808473">(Jun 23 2019 at 21:14)</a>:</h4>
<p>if you want to get a visual idea for the variance, some pictures from perf measurement of a research project I am involved in:<br>
instructions: two nice clear lines with basically constant separation: <a href="https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=instructions&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*" target="_blank" title="https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=instructions&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*">https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=instructions&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*</a><br>
time: just a mess: <a href="https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=time&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*" target="_blank" title="https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=time&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*">https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=time&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*</a><br>
cycles are less messy but still don't give a useful signal here: <a href="https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=cycles&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*" target="_blank" title="https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=cycles&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*">https://coq-speed.mpi-sws.org/d/Ne7jkX6kk/coq-speed?orgId=1&amp;from=1556168879192&amp;to=1558362701773&amp;var-metric=cycles&amp;var-project=iris&amp;var-branch=master&amp;var-config=All&amp;var-group=().*</a><br>
(beware, non-zeroed y axis)</p>



<a name="168808487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808487">(Jun 23 2019 at 21:15)</a>:</h4>
<p>this is on a system where we did what we could, with our limited knowledge, to isolate things in terms of performance (it's a 2-socket system with one socket entirely reserved to the thing being benchmarked)</p>



<a name="168808531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168808531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168808531">(Jun 23 2019 at 21:16)</a>:</h4>
<p>ah here's the post by nnethercote I was mentioning earlier: <a href="https://internals.rust-lang.org/t/what-is-perf-rust-lang-org-measuring-and-why-is-instructions-u-the-default/9815/5?u=ralfjung" target="_blank" title="https://internals.rust-lang.org/t/what-is-perf-rust-lang-org-measuring-and-why-is-instructions-u-the-default/9815/5?u=ralfjung">https://internals.rust-lang.org/t/what-is-perf-rust-lang-org-measuring-and-why-is-instructions-u-the-default/9815/5?u=ralfjung</a></p>



<a name="168809356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168809356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168809356">(Jun 23 2019 at 21:44)</a>:</h4>
<p>Now, can I trick criterion into gathering those numbers and making a pretty graph</p>



<a name="168830976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168830976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168830976">(Jun 24 2019 at 08:24)</a>:</h4>
<p>if you find out how, please tell us!</p>



<a name="168860241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168860241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168860241">(Jun 24 2019 at 15:35)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> is that branchy code?</p>



<a name="168860253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168860253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168860253">(Jun 24 2019 at 15:35)</a>:</h4>
<p>Dedicating a single core is not sufficient when cache is shared.</p>



<a name="168878007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168878007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168878007">(Jun 24 2019 at 19:29)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> looks like it’s getting closer to possible: <a href="https://github.com/bheisler/criterion.rs/issues/130" target="_blank" title="https://github.com/bheisler/criterion.rs/issues/130">https://github.com/bheisler/criterion.rs/issues/130</a></p>



<a name="168878820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168878820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168878820">(Jun 24 2019 at 19:40)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> </p>
<blockquote>
<p>Dedicating a single core is not sufficient when cache is shared.</p>
</blockquote>
<p>I said <em>single socket</em></p>



<a name="168878823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168878823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168878823">(Jun 24 2019 at 19:40)</a>:</h4>
<p>as in, entire physical CPU. dedicated L1, L2, L3 caches and even dedicated memory controller, if the OS doesn't screw up and allocate memory attached to the other socket.</p>



<a name="168878838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168878838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168878838">(Jun 24 2019 at 19:40)</a>:</h4>
<p>that machine has two of them, each with 10 cores and HT (so 40 virtual cores total)</p>



<a name="168878864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168878864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168878864">(Jun 24 2019 at 19:40)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> is that branchy code?</p>
</blockquote>
<p>no idea. this is running Coq to check proofs we wrote. Coq is written in OCaml.</p>



<a name="168878993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168878993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168878993">(Jun 24 2019 at 19:42)</a>:</h4>
<p>Anyone know <em>how</em> to read the instruction count? Is that a magic x86 register thing?</p>



<a name="168879117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879117">(Jun 24 2019 at 19:44)</a>:</h4>
<p>I know how to do it with <code>perf</code>^^</p>



<a name="168879125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879125">(Jun 24 2019 at 19:44)</a>:</h4>
<p>which uses special Linux kernel APIs</p>



<a name="168879228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879228">(Jun 24 2019 at 19:46)</a>:</h4>
<p>pffft. I like writing that low-level assembly</p>



<a name="168879268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879268">(Jun 24 2019 at 19:46)</a>:</h4>
<p>well <code>perf</code> does way more than this magic instruction that also exists</p>



<a name="168879270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879270">(Jun 24 2019 at 19:46)</a>:</h4>
<p>There’s <a href="http://gz.github.io/rust-perfcnt/perfcnt/" target="_blank" title="http://gz.github.io/rust-perfcnt/perfcnt/">http://gz.github.io/rust-perfcnt/perfcnt/</a>, but it’s lInux-only for that reason</p>



<a name="168879306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879306">(Jun 24 2019 at 19:47)</a>:</h4>
<p>sure, but how much of that is needed in the context of e.g. criterion?</p>



<a name="168879307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879307">(Jun 24 2019 at 19:47)</a>:</h4>
<p>it's some kind of statistical thing where the CPU takes snapshots of stuff and runs a bit of priviledged code to compress it enough to allow streaming the rest to disk for post-mortem analysis or whatever... you end up being told in which function all the instructions are spent etc. a bit like callgrind, but without the overhead. it's pure magic.</p>



<a name="168879320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168879320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168879320">(Jun 24 2019 at 19:47)</a>:</h4>
<blockquote>
<p>sure, but how much of that is needed in the context of e.g. criterion?</p>
</blockquote>
<p>I have no idea. ;) Just know the user side of this.</p>



<a name="168880932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168880932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168880932">(Jun 24 2019 at 20:07)</a>:</h4>
<p>Perfcounters are most likely not directly accessible by user-space programs.</p>



<a name="168881021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168881021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168881021">(Jun 24 2019 at 20:08)</a>:</h4>
<p>So your options are to a) figure out what (possibly undocumented) syscall things like Instruments use to measure that or b) write a kernel module which exposes that data to you</p>



<a name="168881514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168881514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168881514">(Jun 24 2019 at 20:15)</a>:</h4>
<p>dtrace should be similar enough to <code>perf</code> on macOS I think</p>



<a name="168881529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168881529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168881529">(Jun 24 2019 at 20:15)</a>:</h4>
<p>I know very little about it though</p>



<a name="168882585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168882585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168882585">(Jun 24 2019 at 20:29)</a>:</h4>
<p>If you have SIP enabled on macOS, you're going to have a bad time trying to use dtrace. For example: <a href="https://www.reddit.com/r/macsysadmin/comments/ahrn10/has_apple_broken_dtruss_in_mojave/" target="_blank" title="https://www.reddit.com/r/macsysadmin/comments/ahrn10/has_apple_broken_dtruss_in_mojave/">https://www.reddit.com/r/macsysadmin/comments/ahrn10/has_apple_broken_dtruss_in_mojave/</a></p>



<a name="168883803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168883803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168883803">(Jun 24 2019 at 20:46)</a>:</h4>
<p>I gather SIP here is not the VoIP protocol...?</p>



<a name="168884159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168884159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168884159">(Jun 24 2019 at 20:51)</a>:</h4>
<p>system integrity protection</p>



<a name="168884251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168884251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168884251">(Jun 24 2019 at 20:52)</a>:</h4>
<p>ah, that makes so much more sense :D</p>



<a name="168887063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/benchmarking%20on%20a%20thermally-constrained%20laptop/near/168887063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/benchmarking.20on.20a.20thermally-constrained.20laptop.html#168887063">(Jun 24 2019 at 21:35)</a>:</h4>
<p>~Hackers are strong tonight~<br>
~They will profile your code~<br>
~Figure out instructions~<br>
~And their costs~<br>
~For much improved security~<br>
~We disabled perfcounters~</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>